﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SQLite;


    public class SQLUtils
    {

        public static DataTable GetDataTable(string sql)
        {
            DataTable dt = new DataTable();
            try
            {
                SQLiteCommand mycommand = new SQLiteCommand(ConexaoBancoDados.ConexaoAtiva());
                mycommand.CommandText = sql;
                SQLiteDataReader reader = mycommand.ExecuteReader();
                dt.Load(reader);
                reader.Close();
            }
            catch (Exception e)
            {
                throw new Exception(e.Message);
            }
            return dt;
        }

        public static string BuilderCommadIN(List<string> str)
        {
            string result = "";
            

            foreach(string value in str){
                result = result + value + ",";
            }

            if (str.Count != 0)
            {
                result = result.Substring(0, result.Length-1);
            }

            return result;

        }

}
